<?php View::display('user/menu');?>
<div class="span9">
	<a href="index.php?page=user/newq">สร้างคำถามใหม่</a>
	<table class="table">
		<thead>
			<tr>
				<th>สร้างเมื่อ</th>
				<th>ตอบล่าสุด</th>
				<th>หัวข้อ</th>
				<th>สถานะ</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($params['topics'] as $key => $value){
			$status = $value['status']==1? 'เปิด': 'ปิด';
			?>
			<tr>
				<td><?php $time = new DateTime($value['createTime']); echo $time->format('j/m/Y');?></td>
				<td>
				<?php
				if(is_null($value['modifyTime'])){ echo '-'; }
				else { $time = new DateTime($value['modifyTime']); echo $time->format('j/m/Y'); }
				?>
				</td>
				<td><a target="_blank" href="index.php?page=user/topic&id=<?php echo $value['id'];?>"><?php echo $value['name'];?></a></td>
				<td><?php echo $status;?></td>
			</tr>
			<?php }?>
		</tbody>
	</table>
</div>
<div class="clearfix"></div>